<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>
<form name="myForm">
  <p>
    <label>
      Form name:
      <input type="text" name="text1" value="Beluga"/>
    </label>
  </p>
  <p>
    <input
        type="button"
        name="button1"
        value="Show Form Name"
        onclick="this.form.text1.value = this.form.OK.innerText"
    />
    <button name="OK" type="button" onclick="this.form.text1.value = this.form.name">
      Show Form Name2
    </button>
  </p>
</form>
</body>
</html>